
export default function wxUploadFile(config){
  return new Promise((resolve, reject) => {
		const {
			url,
      filePath,
      name = 'file',
			data: formData,
			timeout,
			headers: header,
			cancelToken
    } = config
		const requestTask = wx.uploadFile({
			url,
      filePath,
      name,
			formData,
			header,
			timeout,
			success: res => resolve(res),
			fail: err => reject(err),
			complete: () => { }
		})
		if (cancelToken) {
			cancelToken.promise.then(reason => {
				requestTask.abort()
				reject(reason)
			})
		}
	})
}